package com.sui.bigdata.flink.sql.core.metric;

import org.apache.flink.metrics.Meter;

/**
 * @author YongChen
 * @date 2020/4/20 16:27
 * @description
 * @email yong_chen@sui.com
 */
public class JoinLastMinCostAvg implements Meter {

    private long count;

    private long sum;

    public JoinLastMinCostAvg() {
    }

    @Override
    public void markEvent() {

    }

    @Override
    public void markEvent(long l) {
        sum += l;
        count++;
    }

    @Override
    public double getRate() {
        long tempSum = sum;
        long tempCount = count;
        sum = 0;
        count = 0;
        return tempCount == 0 ? 0 : tempSum / tempCount;
    }

    @Override
    public long getCount() {
        return 0;
    }

}
